Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OTLP Exported as default for .NET (Core) #343

Closed
wants to merge 7 commits into from
Closed

OTLP Exported as default for .NET (Core) #343

wants to merge 7 commits into from

Conversation

Kielek
Copy link
Contributor

@Kielek Kielek commented Feb 1, 2022

Partially Fixes #325
Relates to #324

Changes proposed in this pull request:
Use the OTLP exporter as default for the .NET (Core) and Zipkin for .NET Framework

Tests

CI
Local tests for ConsoleApp, works fine for

  • .NET 4.6.1 (Zipkin exporter)
  • .NET Core App 4.1 (otlp)

Works with workaround for

  • .NET 5.0 (otlp)

Issue to be discussed

https://www.nuget.org/packages/Grpc.Net.Client/2.32.0 used by https://www.nuget.org/packages/OpenTelemetry.Exporter.OpenTelemetryProtocol/1.2.0-rc1 is released for

  • .NET Standard 2.1
  • .NET 5.0

Otel-dotnet-inturmenation, for now, is released as .NET 4.6.1 and .NET Core App 3.1.

.NET Core App 3.1 is using .NET Standard 2.1 (deploys Grpc.Net.Client to the tracer-home).

.NET Standard 2.1 of Grpc.Net.Client is not working correctly with .NET 5.0. It leads to following error

info    zapgrpc/zapgrpc.go:174  [transport] transport: loopyWriter.run returning. connection error: desc = "transport is closing"       {"grpc_log": true}

As a workaround, there is a possibility to force load Grpc.Net.Client for .NET 5.0 from the instrumented application. I think that it is not the long-term sollution.

I think that we should consider separate version of otel-intrumentation for .NET 5.0+.

Alternative solution - defaulting to Otel over http/protobuf

Is it possible, and it is working correctly both for .NET Framework 4.6.1, NET Core App 3.1 and .NET 5.0 without any hacks for the end user, but we should consider following things:

To reduce the complication on our side we can consider fixing open-telemetry/opentelemetry-dotnet#2857 and waiting for the next RC candidate. If it will cover updates by the Protocol setter it will reduce complication of the code on our side.

Discusion about changing default exporter to HTTP

open-telemetry/opentelemetry-dotnet#2855

Zipkin remains for .NET Framework
make the version compatible with OtelExporter (Grpc.Net.Client)
instead of Grpc.Net.Client for .NET Standard 2.1 from tracer-home
@Kielek Kielek requested a review from a team February 1, 2022 13:05
@Kielek Kielek changed the title Otlp as default exporter net core OTLP Exported as default for .NET (Core) Feb 1, 2022
@Kielek
Copy link
Contributor Author

Kielek commented Feb 2, 2022

SIG notes: Try to use OTLP over HTTP exporter - check specification and possibility to execute it for all .NET (Core/Framework) versions

@Kielek
Copy link
Contributor Author

Kielek commented Feb 3, 2022

@nrcventura, @pjanotti,
I have checked the possibility to use otlp exporter over http/protobuf.
Is it possible, and it is working correctly both for .NET Framework 4.6.1, NET Core App 3.1 and .NET 5.0 without any hacks for the end user, but we should consider following things

I do not think that we will have possibility to change the defaults after first official release, so it looks like the long term decision.

Personally, I think that we should follow strategies directly from the .NET OTEL SDK.
The cosnsistency will be better for our endusers what is more, we will have less work to maintain duplicated code.

WIP changes,
https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/compare/main...Kielek:otlp-ver-http-as-default-exporter-net-core?expand=1

When the decision will be made, I will be happy to finish this one or create the new one PR with http/protobud as default.

@Kielek
Copy link
Contributor Author

Kielek commented Feb 3, 2022

I will update the first comment to update curent state. It will be esier to follow our options.

@pjanotti
Copy link
Contributor

pjanotti commented Feb 3, 2022

I opened a discussion with SDK for considering a change for the OTLP default from gRPC to HTTP, see open-telemetry/opentelemetry-dotnet#2855

Thanks for the info @Kielek

@Kielek
Copy link
Contributor Author

Kielek commented Feb 4, 2022

I will update the first comment to update curent state. It will be esier to follow our options.

First comment updated.

@nrcventura
Copy link
Member

  • most of the code to manage default values is internal API, we should copy (and maintatin!) it to our code call it by reflections

Can you explain this a little more? If we only support http/protobuf can we just get away with "hardcoding" some of the public configuration options like users of the SDK might do? I just want to get a better understanding of some of the problems that you are trying to solve.

@pellared
Copy link
Member

pellared commented Feb 7, 2022

I am good with merging this PR if we describe how OTLP exporter can be used (together with its gotchas) in USAGE.md.

As far as I understand this would require describing that:

  • gRPC OTLP protocol is not working for .NET Framework. but one can always set the HTTP OTLP protocol
  • gRPC OTLP protocol requires additional package references on .NET 5 and .NET 6
  • OTLP endpoint must be manually set if HTTP OTLP protocol is set

We can have a separate PR to switch to HTTP OTLP protocol by default (also for .NET Framework). It would be easier to do it after open-telemetry/opentelemetry-dotnet#2857 is fixed a new version is released. Also, I think that we can keep the support for the gRPC OTLP protocol (with workarounds and constraints described above). But I am also OK to drop support for gRPC completely and just create an issue for it (maybe nobody would need it anyway).

<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.0.3" />

<!-- Hack to make the otel exportert working for .NET 5.0 -->
<PackageReference Include="Grpc.Net.Client" Version="2.32.0" Condition="'$(TargetFramework)' == 'net5.0'"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want this merged then it should be documented in USAGE.md

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI #350

Exporter = source.GetString(ConfigurationKeys.Exporter);
Exporter = source.GetString(ConfigurationKeys.Exporter) ??
#if NETFRAMEWORK
"zipkin";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively, for.NET Framework, we could still use the OTLP exporter, but set HTTP protocol

@Kielek
Copy link
Contributor Author

Kielek commented Feb 8, 2022

Can you explain this a little more? If we only support http/protobuf can we just get away with "hardcoding" some of the public configuration options like users of the SDK might do? I just want to get a better understanding of some of the problems that you are trying to solve.

I think that, I have found pretty cheap alternative to avoid copying whole code related to managing url (lack od auto-extending endpoints with suffix such as /v1/traces or /v1/metrics). I consider is a good tradeoff, especially if open-telemetry/opentelemetry-dotnet#2868 will be merged shortly.

Closing this one, #351 constrains expected changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use OTLP HTTP/Protobuf Exporter by default
4 participants